const Sequelize = require('sequelize')
const sequelize = require('../libs/db')
class option extends Sequelize.Model {}
option.init(
  {
    optionId: {
      field: 'id',
      type: Sequelize.BIGINT,
      primaryKey: true,
      autoIncrement: true
    },
    optionName: {
      field: 'option_name',
      type: Sequelize.STRING(100),
      allowNull: false,
      comment: '投票选项名称'
    },
    description: {
      field: 'description',
      type: Sequelize.TEXT,
      comment: '简介'
    },
    voteId: {
      field: 'vote_id',
      type: Sequelize.BIGINT,
      allowNull: true,
      defaultValue: 0,
      comment: '关联的投票ID'
    },
    status: {
      field: 'status',
      type: Sequelize.SMALLINT,
      allowNull: true,
      comment: '上下架状态,int。1-上架；0-下架'
    },
    createdAt: {
      field: 'created_at',
      type: Sequelize.BIGINT
    },
    updatedAt: {
      field: 'updated_at',
      type: Sequelize.BIGINT
    }
  },
  {
    sequelize,
    modelName: 'option',
    tableName: 'option'
  }
)

module.exports = option
